<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name=viewport
          content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui">
    <meta name="referrer" content="no-referrer">
    <title>播放器</title>
    <style type="text/css">
        html, body {
            width: 100%;
            height: 100%;
            margin: auto;
            overflow: hidden;
        }

        body {
            display: flex;
        }

        #mse {
            flex: auto;
        }
    </style>
    <script type="text/javascript">
        window.addEventListener('resize', function () {
            document.getElementById('mse').style.height = window.innerHeight + 'px';
        });
    </script>
</head>
<body>
<div id="mse"></div>
<!--
    API文档：http://v2.h5player.bytedance.com/api/#play
-->
<script src="http://sf1-ttcdn-tos.pstatp.com/obj/unpkg/xgplayer/2.9.6/browser/index.js" charset="utf-8"></script>
<script src="http://sf1-ttcdn-tos.pstatp.com/obj/unpkg/xgplayer-flv.js/2.1.2/browser/index.js" charset="utf-8"></script>
<script type="text/javascript">
    const url = "ws://127.0.0.1:8866/live?url=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
    const url2 = "ws://127.0.0.1:8866/live?url=rtmp://58.200.131.2:1935/livetv/dntv";
    let player = new window.FlvJsPlayer({
        id: 'mse',
        url: url,
        // fitVideoSize: 'auto',
        fluid: true,
        autoplay: false,
        isLive: true,
        playsinline: false,
        screenShot: true,
        whitelist: [''],
        ignores: ['time'],
        height: window.innerHeight,
        width: window.innerWidth,
        closeVideoClick: true,
        // errorTips: '<span class="app-error">无视频源</span>',
        customConfig: {},
        flvOptionalConfig: {
            enableWorker: true,
            enableStashBuffer: true, //启用缓存
            stashInitialSize: 4096, //缓存大小4m
            lazyLoad: false,
            lazyLoadMaxDuration: 40 * 60,
            autoCleanupSourceBuffer: true,
            autoCleanupMaxBackwardDuration: 35 * 60,
            autoCleanupMinBackwardDuration: 30 * 60
        }
    });
    // player.play();
    // player.pause()
    // player.reload()
    // player.destroy();
</script>
</body>
</html>
